package com.qf.fmall2202.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.fmall2202.user.entity.UserAddr;
import com.qf.fmall2202.user.service.IUserAddrService;
import com.qf.fmall2202.utils.R;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户地址  前端控制器
 * </p>
 *
 * @author dong_
 * @since 2022-11-09
 */
@CrossOrigin
@RestController
@RequestMapping("/useraddr")
public class UserAddrController {

    @Autowired
    IUserAddrService userAddrService;

    @GetMapping("/list")
    public R list(Integer userId){

        final List<UserAddr> userAddrList = userAddrService.list(new LambdaQueryWrapper<UserAddr>().eq(UserAddr::getUserId, userId));

        return R.ok().put("data", userAddrList);

    }

}
